#include "state.h"

#include "context.h"

namespace HsmState {
// 设置时间响应回调函数
void State::set_event_func(std::function<EventDeal(EventData&)> func) {
    _event_func = func;
}

EventDeal State::runEventFunc(EventData& event_data) {
    if (_event_func == nullptr) return keepOn;
    return _event_func(event_data);
}

void State::setContext(Context* context) { _context = context; }

void State::transState(std::string name) { _context->transForState(name); }
}  // namespace HsmState